package ArrayList;
import java.util.ArrayList;

public class ArrRemove {
    public static void main(String[] args){
        ArrayList<String> list = new ArrayList<>();
        list.add("123");
        list.add("456");
        list.add("789");
        list.add("123456");
        System.out.println(list);

        for(int i = list.size()-1;i >= 0 ;i--){
            String ele = list.get(i);
            if(ele.contains("123")){
                list.remove(i);
            }

        }
        System.out.println(list);
    }
}
